﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace Oridea.Data.Fetching {
	public class PagingCollectionFetcher<T> : CollectionFetcher<T>, IPagingFetcher<T> {
		public PagingCollectionFetcher(IQueryable<T> query) : base(query) { }

		public ReadOnlyCollection<T> FetchPage(int pageNumber, int rowsNumber) {
			return Query.Skip(pageNumber * rowsNumber).Take(rowsNumber).ToList().AsReadOnly();
		}
	}
}
